let api = require('../../config/api.js');
let user = require('../../utils/user.js');

let app = getApp();

Page({
    data: {
        hasLogin:false
    },
    //页面显示
    onShow() {
        if(app.globalData.hasLogin){
            this.getCartList()
        }
        this.setData({
            hasLogin:app.globalData.hasLogin
        })
    },
    goLogin() {
        wx.navigateTo({
          url: "/pages/auth/login/login"
        });
      },
      getCartList: function() {
        let that = this;
        util.request(api.CartList).then(function(res) {
          if (res.errno === 0) {
            that.setData({
              cartGoods: res.data.cartList,
              cartTotal: res.data.cartTotal
            });
    
            that.setData({
              checkedAllStatus: that.isCheckedAll()
            });
          }
        });
      },
})